﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using Ninject;
namespace ecdl.demo.persistence {
    public abstract class DTO<ModelType> {
        public abstract ModelType ToModel(ModelFactory factory);

    }

    public class ModelFactory {

        private IKernel injector;
        [Inject]
        public ModelFactory(IKernel injector) {
            this.injector = injector;
        }

        public ModelType CreateModel<ModelType>() {
            return (ModelType)CreateModel(typeof(ModelType));
        }

        public object CreateModel(Type t) {
            return injector.Get(t);
        }
    }
}
